Merged
Conversation
- use include pattern instead of rendering in class
- download zip file including logs and information about setup
- added utility classes
rkoopmans
reviewed
Jan 7, 2026
rkoopmans
reviewed
Jan 7, 2026
…task/logging-troubleshooting
rkoopmans
reviewed
Jan 9, 2026
There was a problem hiding this comment.
Pull request overview
This PR adds logging and diagnostics capabilities to help troubleshoot customer issues. It introduces a file-based logger with automatic rotation at 2MB, a diagnostics export feature that bundles logs and system information into a downloadable zip file, and sets API request timeouts (120s total, 8s connect) to prevent indefinite hanging.
Changes:
- Introduced
Tiny_Loggersingleton for file-based logging with 2MB rotation - Added
Tiny_Diagnosticsclass to collect system info and generate downloadable diagnostics zip files - Integrated logging calls throughout the compression workflow
- Added settings UI for enabling/disabling logging and downloading diagnostics
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| tiny-compress-images.php | Added requires for new logger and diagnostics classes |
| test/unit/TinySettingsAjaxTest.php | Refactored test to use new assertHook helper method |
| test/unit/TinySettingsAdminTest.php | Added test for new logging_enabled setting registration |
| test/unit/TinyLoggerTest.php | Added comprehensive tests for logger singleton, file creation, rotation, and enable/disable behavior |
| test/unit/TinyDiagnosticsTest.php | Added tests for diagnostics action hook and info collection |
| test/helpers/wordpress.php | Added assertHook helper, WordPressMocks class with mock WordPress functions, and formatting updates |
| src/views/settings.php | Included new diagnostics settings partial |
| src/views/settings-diagnostics.php | New view for logging toggle and diagnostics download button |
| src/js/admin.js | Added AJAX handler for diagnostics download |
| src/css/admin.css | Added utility classes for diagnostics UI |
| src/class-tiny-settings.php | Instantiated diagnostics and registered logging_enabled setting |
| src/class-tiny-plugin.php | Initialized logger and added debug logging throughout compression flow |
| src/class-tiny-logger.php | New singleton logger with file rotation and WordPress option integration |
| src/class-tiny-image.php | Added detailed debug and error logging for compression operations |
| src/class-tiny-diagnostics.php | New class for collecting and exporting diagnostic information |
| src/class-tiny-compress-fopen.php | Added debug logging for fopen compression responses |
| src/class-tiny-compress-client.php | Added timeout constants, error logging, and applied timeout settings to client |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add comprehensive test for nonce verification in the download_diagnostics AJAX endpoint. The test verifies that check_ajax_referer is called with the correct parameters and that wp_die is invoked when nonce verification fails. Also: - Add check_ajax_referer and wp_die mock implementations to WordPress test helpers - Add wp_json_encode mock for test compatibility - Rename test file to match class name convention (Tiny_Diagnostics_Test.php)
rkoopmans
approved these changes
Jan 22, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We had two customers reporting two different issues which we could not figure out. Often times this is due to setup configurations but it is hard to figure out.
Having some diagnostics and logs should make it easier to troubleshoot these issues.
This PR will also:
Good to know
Screenshots

Customers can turn on logging and download a diagnostics zip file from within settings